package com.hnkywl.sts.entity.zjgl;

import com.hnkywl.sts.entity.BaseEntity;
import com.hnkywl.sts.entity.organ.Ejzh;
import com.hnkywl.sts.entity.organ.Khh;
import com.hnkywl.sts.entity.organ.Nbgs;
import com.hnkywl.sts.entity.organ.Qyjg;
import com.hnkywl.sts.entity.sys.Yg;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.hibernate.annotations.Where;

import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * 说明：银行授信
 * 包:        com.hnkywl.sts.entity.zjgl
 * 类描述:    银行授信
 * 修改备注: [说明本次修改内容]
 * 版本:        [v1.0]
 */
@Entity
@Table(name = "T_BIZ_YHSX")
@Where(clause = "deleted!='1'")
public class Yhsx extends BaseEntity {
    @Id
    @SequenceGenerator(name = "seqYhsx", allocationSize = 1, sequenceName = "SEQ_BIZ_YHSX")
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seqYhsx")
    private Long id;

    /**
     *  还款状态（未还款，已还款） 0 新建  1确认  2  还款中  3 已还款
     */
    private Integer zt;

    /**
     * 内部公司
     */
    @ManyToOne
    @JoinColumn(name="NBGS_ID")
    private Nbgs nbgs;

    /**
     * 借款银行
     */
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name="KHH_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Khh khh;

    /**
     * 借款金额
     */
    private Double jkje;

    /**
     * 月利率
     */
    private Double yll;

    /**
     * 利息额
     */
    private Double lxe;

    /**
     *实际还息额
     */
    private Double sjhxe;

    /**
     * 累计还款
     */
    private Double ljhk;

    /**
     * 借款日期
     */
    private Date jkrq;

    /**
     * 到期日期
     */
    private Date dqrq;

    /**
     * 备注
     */
    private String bz;

    /**
     * 制单人
     */
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "ZDR_ID")
    private Yg zdr;

    /**
     * 银行授信明细列表
     */
    @OneToMany(fetch = FetchType.LAZY, targetEntity = Yhsxmx.class, mappedBy = "yhsx")
    @NotFound(action = NotFoundAction.IGNORE)
    @Where(clause = "deleted!='1'")
    private List<Yhsxmx> yhsxmxList;

    //初始化字段  凡是从老系统导入的为初始化字段  置为 1  其他为非初始化
    private String csh ;


    //授信公司
    @ManyToOne
    @JoinColumn(name="SXGS_ID")
    private Qyjg sxgs;







    //授信公司二级账户
    @ManyToOne
    @JoinColumn(name="SXGSEJZH_ID")
    private Ejzh sxgsejzh;

    private String sxlx;

    //贷款方
    @ManyToOne
    @JoinColumn(name="DKF_ID")
    private Qyjg dkf;

    //是否银行贷款
    private Boolean sfYhdk;


    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Integer getZt() {
        return zt;
    }

    public void setZt(Integer zt) {
        this.zt = zt;
    }

    public Nbgs getNbgs() {
        return nbgs;
    }

    public void setNbgs(Nbgs nbgs) {
        this.nbgs = nbgs;
    }

    public Khh getKhh() {
        return khh;
    }

    public void setKhh(Khh khh) {
        this.khh = khh;
    }

    public BigDecimal getJkje() {
        BigDecimal bigDecimal = new BigDecimal(jkje==null?0:jkje);
        return bigDecimal;
    }

    public void setJkje(Double jkje) {
        this.jkje = jkje;
    }

    public Double getYll() {
        return yll;
    }

    public void setYll(Double yll) {
        this.yll = yll;
    }

    public Double getLxe() {
        return lxe;
    }

    public void setLxe(Double lxe) {
        this.lxe = lxe;
    }

    public Double getSjhxe() {
        return sjhxe;
    }

    public void setSjhxe(Double sjhxe) {
        this.sjhxe = sjhxe;
    }

    public Date getJkrq() {
        return jkrq;
    }

    public void setJkrq(Date jkrq) {
        this.jkrq = jkrq;
    }

    public Date getDqrq() {
        return dqrq;
    }

    public void setDqrq(Date dqrq) {
        this.dqrq = dqrq;
    }

    public String getBz() {
        return bz;
    }

    public void setBz(String bz) {
        this.bz = bz;
    }

    public Yg getZdr() {
        return zdr;
    }

    public void setZdr(Yg zdr) {
        this.zdr = zdr;
    }

    public BigDecimal getLjhk() {
        BigDecimal bigDecimal = new BigDecimal(ljhk==null?0:ljhk);
        return bigDecimal;
    }

    public void setLjhk(Double ljhk) {
        this.ljhk = ljhk;
    }

    public List<Yhsxmx> getYhsxmxList() {
        return yhsxmxList;
    }

    public void setYhsxmxList(List<Yhsxmx> yhsxmxList) {
        this.yhsxmxList = yhsxmxList;
    }

    public String getCsh() {
        return csh;
    }

    public void setCsh(String csh) {
        this.csh = csh;
    }

    public Qyjg getSxgs() {
        return sxgs;
    }

    public void setSxgs(Qyjg sxgs) {
        this.sxgs = sxgs;
    }

    public Ejzh getSxgsejzh() {
        return sxgsejzh;
    }

    public void setSxgsejzh(Ejzh sxgsejzh) {
        this.sxgsejzh = sxgsejzh;
    }

    public String getSxlx() {
        return sxlx;
    }

    public void setSxlx(String sxlx) {
        this.sxlx = sxlx;
    }

    public Qyjg getDkf() {
        return dkf;
    }

    public void setDkf(Qyjg dkf) {
        this.dkf = dkf;
    }

    public Boolean getSfYhdk() {
        return sfYhdk;
    }

    public void setSfYhdk(Boolean sfYhdk) {
        this.sfYhdk = sfYhdk;
    }
}
